package com.sql.parser.lineage;

import com.sql.parser.lineage.utils.MySQLMetadataUtils;

import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;

public class AppPrestoSQLtest {

    public static void main(String[] args) {
        try {
            String[] tables = {"ads.ads_equ_info_admin_mp_basic_o_a_d"};
            List<String[]> metadataList = MySQLMetadataUtils.getColumnsMetadata(Arrays.asList(tables));

            // 输出列的元数据信息
            for (String[] metadata : metadataList) {
                String catalog = metadata[0];
                String schema = metadata[1];
                String tableName = metadata[2];
                String columnName = metadata[3];
                String dataType = metadata[4];
                int columnSize = Integer.parseInt(metadata[5]);
                int decimalDigits = Integer.parseInt(metadata[6]);
                boolean isNullable = Boolean.parseBoolean(metadata[7]);

                System.out.println("Catalog: " + catalog);
                System.out.println("Schema: " + schema);
                System.out.println("Table name: " + tableName);
                System.out.println("Column name: " + columnName);
                System.out.println("Data type: " + dataType);
                System.out.println("Column size: " + columnSize);
                System.out.println("Decimal digits: " + decimalDigits);
                System.out.println("Nullable: " + isNullable);
            }
        } catch (SQLException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}

